<% @page_title = "Add new user" %>
<%= stylesheet_link_tag "admin/form", :media => "all" %>
<div class="create-reader-form">
  <h1>Add new user</h1>
  <div class='content'>
  <%= form_for(:user, :url => {:controller => 'admin/user', :action => 'create'}) do |f| %>
  	<p><label>Full Name:</label> <%= f.text_field :fullname %></p>
  	<p><label>Reader Card ID:</label><%= f.text_field :card_id %></p>
    <p><label>Username:</label> <%= f.text_field :username %></p>
    <p><label>Password:</label> <%= f.password_field :password %></p>
    <p><label>Password confirmation:</label><%= f.password_field :password_confirmation%></p>
    <p><label>Email:</label> <%= f.text_field :email %></p>
    <p><label>Phone number:</label><%= f.text_field :phone %></p>
    <p><label>Faculty:</label><%= collection_select :user, :faculty_id, Faculty.all, :id, :faculty_name %></p>
    <p><label>Student/Staff ID:</label><%= f.text_field :reader_id %></p>
    <p><label>Reader group:</label><%= collection_select :user, :role_id, Role.all, :id, :role_name %></p>
    
    <p class='action'><label>&nbsp;</label><%= f.submit :Save %><%= link_to "Back", :controller => "admin/user", :action => "index" %></p>
  <% end %><!-- End form -->
  </div><!-- End .content -->
</div><!-- End .create-reader-form -->

<div class='clear'></div>

<% if flash[:notice] %>
	<div class='notice'>
		<h1>Notice</h1>
		<div class='content'>
			<!--<%= flash[:notice] %> -->
			<% flash[:notice] = nil %>
		</div>
	</div>
<% end %>
  
<% if @user.errors.any? %>
  <div class='errors'>
    <ul class="create-reader-errors">
    <% for message_error in @user.errors.full_messages %>
      <li>* <%= message_error %></li>
    <% end %>
    </ul>
  </div><!-- End .errors -->
<% end %>











